package com.bluegalaxy.sitescore.service.impl;

import com.bluegalaxy.sitescore.entity.SelectDangerous;
import com.bluegalaxy.sitescore.mapper.TbSelectDangerousMapper;
import com.bluegalaxy.sitescore.service.ITBSelectDangerousService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class TBSelectDangerousServiceImpl implements ITBSelectDangerousService {

    @Autowired
    private TbSelectDangerousMapper tbSelectDangerousMapper;

    @Override
    public List<SelectDangerous> getDangerousBysid(int sid,int type) {
        List<SelectDangerous> selectDangerousList = new ArrayList<>();
        if(type==-1){
            selectDangerousList = tbSelectDangerousMapper.getDangerousBySid2(sid);
        }else {
            selectDangerousList = tbSelectDangerousMapper.getDangerousBySid(sid,type);
        }

       //将缓存值存入对象中
      /*  for (SelectDangerous selectDangerous:selectDangerousList){
            selectDangerous.setPers_riv(1);
            selectDangerous.setPers_lak(0.5);
            selectDangerous.setBcff(5);
            selectDangerous.setBcfs(50);
            selectDangerous.setTox_fen(10);
            selectDangerous.setTox_sen(100);
            selectDangerous.setBcfef(0.4);
            selectDangerous.setBcfes(1);
            selectDangerous.setA_enf(500);
            selectDangerous.setA_ens(50);
            selectDangerous.setMoblk(1);
            selectDangerous.setMoblnk(0.1);
            selectDangerous.setMobnlk(0.01);
            selectDangerous.setMobnlnk(0.2);
            //System.out.println(selectDangerous.getChnname());
        }*/
        return selectDangerousList;
    }

    @Override
    public boolean delDangerousListById(List<Integer> idList) {
        return tbSelectDangerousMapper.delDangerousListById(idList);
    }

    @Override
    public boolean delDangerousListBySid(int sid) {
        return tbSelectDangerousMapper.delDangerousListBySid(sid);
    }

    @Override
    public boolean insertDangerousList(List<SelectDangerous> selectDangerousList) {
        return tbSelectDangerousMapper.insertDangerousList(selectDangerousList);
    }

    @Override
    public boolean insertDangerousList2(List<SelectDangerous> selectDangerousList) {
        return tbSelectDangerousMapper.insertDangerousList2(selectDangerousList);
    }
}
